﻿Imports System.Data
Imports System.Data.SqlClient

Public Class EstadosADO
    Dim oConnections As New ConexionADO
    Dim oCnx As New SqlConnection(oConnections.GetCnx)
    Dim cmd As New SqlCommand

    Public Function Get_EstadoVuelo() As DataTable
        Dim dt As New DataTable
        Try
            cmd.Connection = oCnx
            cmd.CommandType = CommandType.Text
            cmd.CommandText = "SELECT codEstadoVuelo as Codigo, desEstadoVuelo as Descripcion FROM M_Estado_Vuelo"

            Dim ada As New SqlDataAdapter(cmd)
            ada.Fill(dt)
            Return dt
        Catch ex As Exception
            MsgBox("Estado vuelo" & ex.Message, MsgBoxStyle.Critical)
            Return Nothing
        End Try
    End Function

    Public Function Get_EstadoManifiesto() As DataTable
        Dim dt As New DataTable
        Try
            cmd.Connection = oCnx
            cmd.CommandType = CommandType.Text
            cmd.CommandText = "SELECT codEstadoManifiesto as Codigo, desEstadoManifiesto as Descripcion FROM M_Estado_Manifiesto"

            Dim ada As New SqlDataAdapter(cmd)
            ada.Fill(dt)
            Return dt
        Catch ex As Exception
            MsgBox("Estado manifiesto" & ex.Message, MsgBoxStyle.Critical)
            Return Nothing
        End Try
    End Function

    Public Function Get_EstadoReserva() As DataTable
        Dim dt As New DataTable
        Try
            cmd.Connection = oCnx
            cmd.CommandType = CommandType.Text
            cmd.CommandText = "SELECT codEstadoReserva as Codigo, desEstadoReserva as Descripcion FROM M_Estado_Reserva"

            Dim ada As New SqlDataAdapter(cmd)
            ada.Fill(dt)
            Return dt
        Catch ex As Exception
            MsgBox("Estado reserva" & ex.Message, MsgBoxStyle.Critical)
            Return Nothing
        End Try
    End Function
End Class
